package com.xw.class10;

/**
 * @author XW
 * @data 2023/6/12 16:55
 * @description
 */
public class Code02_IteratorBinaryTree {
    static class Node{
        Node left;
        Node right;
        int value;

        public Node(int value){
            this.value = value;
        }
    }

    public static void preOrder(Node head){
        if(null == head){
            return;
        }
        System.out.print(head.value + " ");
        preOrder(head.left);
        preOrder(head.right);
    }

    public static void midOrder(Node head){
        if(null == head ){
            return;
        }
        midOrder(head.left);
        System.out.print(head.value + " ");
        midOrder(head.right);
    }



    public static void main(String[] args) {
        Node head = new Node(1);
        head.left = new Node(2);
        head.right = new Node(3);
        head.left.left = new Node(4);
        head.left.right = new Node(5);
        head.right.left = new Node(6);
        head.right.right = new Node(7);

        preOrder(head);
    }
}
